﻿/*
 * Copyright (c) 2012 Loren M Halvorson
 * This source is subject to the Microsoft Public License (Ms-PL).
 * See http://www.microsoft.com/resources/sharedsource/licensingbasics/publiclicense.mspx.
 * All other rights reserved.
 * Portions copyright 2002-2007 The Genghis Group (http://www.genghisgroup.com/)
 */

using System;
using System.Reflection;

using CookComputing.XmlRpc;

namespace ScrapeDocs
{
    /// <summary>
    /// Proxy for a blog that supports the MetaBlog API
    /// </summary>
    public class BlogProxy : XmlRpcClientProtocol
    {
        /// <summary>
        /// Initializes a new instance of the <see cref="BlogProxy"/> class.
        /// </summary>
        /// <param name="url">The URL.</param>
        public BlogProxy(string url)
        {
            this.Url = url;
        }

        /// <summary>
        /// Gets the recent posts.
        /// </summary>
        /// <param name="weblogname">The weblogname.</param>
        /// <param name="user">The user.</param>
        /// <param name="password">The password.</param>
        /// <param name="count">The count.</param>
        /// <returns></returns>
        [XmlRpcMethod("metaWeblog.getRecentPosts")]
        public XmlRpcStruct[] GetRecentPosts(string weblogname, string user, string password, int count)
        {
            return (XmlRpcStruct[])Invoke(MethodBase.GetCurrentMethod(), new object[] { weblogname, user, password, count });
        }
    }
}
